-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Customer Configurable Standardization #53
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM me logic wise but I'll leave it to Alex for a final approval of the code
packages/GA4Client/src/common.js
Outdated
name = window.GoogleAnalytics4Kit.setCustomNameStandardization(name); | ||
} catch (e) { | ||
console.warn( | ||
'Error calling setCustomNameStandardization callback. Check your callback. Data will still be sent without user-defined standardization', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we provide a link to our docsite? If not in the error log, perhaps we can provide a link to the docsite or example code as a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't started the docs yet. But that's a good idea.
// Due to current limitations, the API for allowing a customer to cleanse | ||
// their data before our cleansing occurs must be placed on the | ||
// window.GoogleAnalytics4Kit object. This exists when initializing MP | ||
// SDK via snippet, but not via npm. If a customer uses npm, using the API | ||
// requires window.GoogleAnalytics4Kit to exist on the page. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial part is a little unclear. Does this make more sense?
// Due to current limitations, the API for allowing a customer to cleanse | |
// their data before our cleansing occurs must be placed on the | |
// window.GoogleAnalytics4Kit object. This exists when initializing MP | |
// SDK via snippet, but not via npm. If a customer uses npm, using the API | |
// requires window.GoogleAnalytics4Kit to exist on the page. | |
// To allow customers to cleanse their data before mParticle | |
// internal cleansing occurs, we must add a simple API into the | |
// window.GoogleAnalytics4Kit object. This object will be automatically | |
// initialized when MP SDK initializes via snippet, but not via npm. | |
// Customers using npm, a customer must manually add | |
// window.GoogleAnalytics4Kit to the page themselves. |
Co-authored-by: Alex S <[email protected]>
# [1.3.0](v1.2.0...v1.3.0) (2023-10-02) ### Features * Add Customer Configurable Standardization ([#53](#53)) ([c851914](c851914))
Summary
This PR allows a customer to pass a standardization callback for name that affects event name, custom attributes, and product attributes.
Testing Plan
Added unit tests. Tested locally.
The callback I used was to remove the last letter of each string.
Screen shot 1 shows a transaction sent with product attributes and custom attributes.
Note that
eventMetric1
gets shortened toeventMetric
in the payload.journeyType
-->journeyTyp
, andsale
-->sal
.Screenshot 2
Shows
name
-->nam
,abc
-->ab
, anddef
-->de
.Master Issue
Closes https://go.mparticle.com/work/SQDSDKS-5641